<?php

namespace Bean;

abstract class Flow extends \Library\Bean {

	const N_ITEMS_BY_BLOCK = 35;

	public function __construct() {
	}

	public abstract function isReadable( User $user = null );
	
	public function isWritable( User $user = null ) {
		return $this->isReadable( $user );
	}
	
	public abstract function getItems( $i = 0 );

	public function getWriter() {
		return preg_replace( '/.*\\\/', '', get_class($this) ) . '/Writer' ;
	}
	
	public abstract function getGenericId();
	
	public static function get( $genericId ) {
		$pos = strpos($genericId, ':');
		$class = '\Bean\Flow\\' . substr($genericId, 0, $pos) . 'Flow';
		return $class::get( substr($genericId, $pos+1) );
	}
	
	public function getView() {
		return 'Widget/Flow';
	}
}
